home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 103 / XENIATGM103.iso / Shareware / GoLive 5.0 / MM9.Cab / F1497_plugnpay.actions5.asp.9B3B646D_CB56_4EAE_BAB7_3E7E8E41A649 < prev    next >
Text File  |  2000-08-17  |  4KB  |  106 lines

  1. <SCRIPT runat="server" language="JScript">
  2.     
  3. // *****************************************************************************
  4. //
  5. // plugnpay.actions5.asp
  6. //
  7. // Plug'n Pay support for Dynamic Link.
  8. //
  9. // COPYRIGHT (c) 2000 Adobe Systems Incorporated. All rights reserved.
  10.  
  11.  
  12. // -----------------------------------------------------------------------------
  13. // SetupPlugNPayCheckout
  14. //
  15. // Write the form controls onto the page needed to process the current
  16. // shopping basket using Plug'n Pay.  The page must include the E-Commerce
  17. // Information content source so that this function can access the contents
  18. // of the shopping cart.
  19. //
  20. //        publisher-name        username issued by Plug'n Pay
  21. //        publisher-email        e-mail address to send order confirmation
  22. //        success-link        url to success page
  23. //        badcard-link        url to failed credit check page
  24. //        problem-link        url to general error page
  25. // 
  26. // Other variables are described in the Plug'n Pay documentation.
  27. // -----------------------------------------------------------------------------
  28.  
  29. function SetupPlugNPayCheckout(contentSource, allRecords, publisher_name,
  30.                                publisher_email, success_link, badcard_link,
  31.                                problem_link)
  32. {
  33.     var pnpVariables = new Array;
  34.  
  35.     pnpVariables["easycart"] = 1;
  36.     pnpVariables["app-level"] = 3;
  37.  
  38.     pnpVariables["publisher-name"] = publisher_name;
  39.     pnpVariables["publisher-email"] = publisher_email;
  40.  
  41.     var thisPage = Request("URL");
  42.     if (Request("HTTPS") == "ON") {
  43.         var serverString = "HTTPS://" + Request("SERVER_NAME") + ":" + Request("SERVER_PORT");
  44.     } else {
  45.         var serverString = "HTTP://" + Request("SERVER_NAME") + ":" + Request("SERVER_PORT");
  46.     }
  47.     var queryString = Request("QUERY_STRING");
  48.     if (String(success_link).length) {
  49.         pnpVariables["success-link"] = serverString + absolutePath(thisPage, success_link) + queryString;
  50.     }
  51.     if (String(badcard_link).length) {
  52.         pnpVariables["badcard-link"] = serverString + absolutePath(thisPage, badcard_link) + queryString;
  53.     }
  54.     if (String(problem_link).length) {
  55.         pnpVariables["problem-link"] = serverString + absolutePath(thisPage, problem_link) + queryString;
  56.     }
  57.  
  58.     pnpVariables["card-amount"] = orderForm.Value("_total_total");
  59.     orderForm.items.MoveFirst();
  60.     var n = 0;
  61.     while (!orderForm.items.EOF) {
  62.         n++;
  63.         pnpVariables["item" + n] = orderForm.items.Value("SKU");
  64.         pnpVariables["cost" + n] = orderForm.items.Value("_iadjust_currentprice");
  65.         pnpVariables["quantity" + n] = orderForm.items.Value("Quantity");
  66.         pnpVariables["description" + n] = orderForm.items.Value("_product_name");
  67.         orderForm.items.MoveNext();
  68.     }
  69.  
  70.     //Close parent <input>
  71.     Response.Write(">\n");
  72.  
  73.     // Write out the plug'n pay variables:
  74.     for (var x in pnpVariables) {
  75.         Response.Write("<input type='hidden' name='" + x + "' value='" + pnpVariables[x] + "'>\n");
  76.     }
  77.  
  78.     //Protect original close of parent <input>
  79.     Response.Write( "<" );
  80.     Response.Write( "wbr" );
  81. }
  82.  
  83. // -----------------------------------------------------------------------------
  84. // PlugNPayCheckout
  85. // -----------------------------------------------------------------------------
  86.  
  87. function PlugNPayCheckout()
  88. {
  89.     var publisherName = Request("publisher-name");
  90.     var queryString = Request.QueryString;
  91.     var postData = Request.Form;
  92.     var url = "https://pay1.plugnpay.com/payment/" + publisherName + "pay.cgi" + "?" + queryString + postData;
  93.     Response.Redirect(url);
  94. }
  95.  
  96. // -----------------------------------------------------------------------------
  97. // Dispatch
  98. // -----------------------------------------------------------------------------
  99.  
  100. if (String(Request.ServerVariables("PATH_TRANSLATED")).indexOf("plugnpay.actions5.asp") >= 0)
  101. {
  102.     PlugNPayCheckout();
  103. }
  104.  
  105. </SCRIPT>
  106.